package com.yihu.cms.service;

import java.io.IOException;

import com.yihu.beans.ResultVO;
import com.yihu.beans.user.Group;
import com.yihu.beans.user.GroupRoleRef;
import com.yihu.beans.user.Role;
import com.yihu.beans.user.RolePermitRef;
import com.yihu.beans.user.RoleQuery;
import com.yihu.dataService.hessian.mongodb.interfaceService.GroupRoleHService;
import com.yihu.dataService.hessian.mongodb.interfaceService.UserGroupHService;
import com.yihu.dataService.hessian.resource.ResourceMongoDBManager;

public class GroupRoleService {
	GroupRoleHService roleService = null;
	public GroupRoleService(){
		try {
			roleService= (GroupRoleHService)ResourceMongoDBManager.getSingleton().getBeans("groupRoleServiceHSC");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public ResultVO addRole(Role role){
		return roleService.addRole(role);
	}
	public ResultVO deleteRole(long id){
		return roleService.deleteRole(id);
	}
	public ResultVO updateRole(Role role){
		return roleService.updateRole(role);
	}
	public Role getRole(long id){
		return roleService.getRole(id);
	}
	public String getRoleByPage(RoleQuery query){
		return roleService.getRoleByPage(query);
	}
	public Role getGroupsByRoleId(RoleQuery query){
		return roleService.getGroupsByRoleId(query);
	}
	public ResultVO addGroupToRole(GroupRoleRef gRef){
		return roleService.addGroupToRole(gRef);
	}
	public ResultVO deleteGroupToRole(GroupRoleRef gRef){
		return roleService.deleteGroupToRole(gRef);
	}
	
	public ResultVO addPriviledgeToRole(RolePermitRef gRef){
		return roleService.addPriviledgeToRole(gRef);
	}
	
	public ResultVO deletePriviledgeFromRole(RolePermitRef gRef){
		return roleService.deletePriviledgeFromRole(gRef);
	}
	
	public Object getPriviledgesByRoleId(RoleQuery query){
		return roleService.getPriviledgesByRoleId(query);
	}
	public ResultVO assignPermits(RolePermitRef rRef){
		return roleService.assignPermits(rRef);
	}
	
	public ResultVO assignGroups(GroupRoleRef gRef){
		return roleService.assignGroups(gRef);
	}
}
